<style lang="less">
.title-text span {
  display: block; /*设置为块级元素会独占一行形成上下居中的效果*/
  position: relative; /*定位横线（当横线的父元素）*/

  color: black; /*居中文字的颜色*/
  font-weight: bold;
  text-align: center;
}

.title-text span:before,
.title-text span:after {
  content: "";
  position: absolute; /*定位背景横线的位置*/
  top: 50%;
  background: #dfdfdf; /*背景横线颜色*/
  width: 44%; /*单侧横线的长度*/
  height: 1px;
}

.title-text span:before {
  left: 0; /*调整背景横线的左右距离*/
}

.title-text span:after {
  right: 0;
}
</style>
<template >

  <div class="search" style="background-color: rgb(255,255,255)">
     <Tabs type="card"  @on-click="clickType">
        <TabPane label="审核页面"></TabPane>
        <TabPane label="影像资料"></TabPane>
      </Tabs>
    <div class="addInfo" style="display: block" v-if="index==0">
      <h2 class="title-text"><span>审核意见</span></h2>
      <Row style="margin-top: 1%;border: 1px solid #dcdee2; border-color: #e8eaec;    margin: 8px;">
        <Form ref="dataForm" :model="dataForm" :label-width="140">
          <Row style="padding-top: 11px">
            <i-col span="12">
              <FormItem label="审核意见" prop="useStstus" style="margin-left: 40%">
                <Select v-model="dataForm.useStstus" filterable style="    width: 200px;" size="default">
                  <Option value="00">通过</Option>
                  <Option value="04">拒绝</Option>
                </Select>
              </FormItem>
            </i-col>

          </Row>
          <Row>
            <i-col span="12">
              <FormItem label="备注" prop="useRemake" style="margin-left: 40%">
                <Input type="text" size="default" v-model="dataForm.useRemake" clearable placeholder="请输入"
                  style="width: 160%" />
              </FormItem>
            </i-col>
            <i-col span="6" v-if="dataForm.useStstus!='02'">
              <Button @click="handleBack" size="large" type="primary"
                style=" float: right;   ">返回</Button>
              <Button @click="handleCommit('dataForm')" size="large" type="primary" 
                style=" float: right; margin-right: 10px;  ">提交</Button>
            </i-col>

          </Row>
          <Row v-if="dataForm.useStstus=='02'">
            <i-col span="12">
              <FormItem label="退回原因" prop="useStartStopReason" style="margin-left: 40%">
                <Input type="text" size="default" v-model="dataForm.useStartStopReason" clearable placeholder="请输入原因"
                  style="width: 160%" />
              </FormItem>
            </i-col>
            <i-col span="6">
              <Button @click="handleBack" size="large"
                style=" float: right;   background-color: rgb(0,153,102);color:white;">返回</Button>
              <Button @click="handleCommit('dataForm')" size="large"
                style=" float: right;   background-color: rgb(0,153,102);color:white;">提交</Button>
            </i-col>
          </Row>

        </Form>
      </Row>
    </div>
    <div class="addInfo" style="display: block" id="thirdCompany" v-if="index==0">
      <h2 class="title-text"><span id="gkType">{{name}}</span></h2>
      <Row style="margin-top: 1%;border: 1px solid #dcdee2; border-color: #e8eaec;    margin: 8px;">
        <Form ref="dataForm" :model="dataForm" :label-width="140">
          <Row style="padding-top: 11px">
            <i-col span="12">
              <FormItem label="黑名单类型" prop="blacklistType" style="margin-left: 40%">
                <Select v-model="dataForm.blacklistType" disabled placeholder="请选择" size="default" style="width: 200px">
                  <Option value="01">合作商</Option>
                  <Option value="02">挂靠单位</Option>
                  <Option value="03">见证人</Option>
                  <Option value="04">开票方</Option>
                  <Option value="05">车商</Option>
                </Select>
              </FormItem>
            </i-col>
            <i-col span="12">
              <FormItem label="名称" prop="blackName" style="margin-left: 10%">
                <Input type="text" size="default" disabled v-model="dataForm.blackName" clearable placeholder="请输入"
                  style="width: 200px" />
              </FormItem>
            </i-col>

          </Row>
          <Row>
            <i-col span="12">
              <FormItem label="证件类型" prop="idType" style="margin-left: 40%">
                <Select v-model="dataForm.idType" disabled placeholder="请选择" size="default" style="width: 200px">
                  <Option value="01">身份证</Option>
                  <Option value="02">统一社会信用代码</Option>
                  <Option value="03">纳税人识别号</Option>
                </Select>
              </FormItem>
            </i-col>
            <i-col span="12">
              <Form-item label="申请加入时间" prop="createTime" style="margin-left: 10%">
                <Date-picker type="date" size="default" disabled v-model="dataForm.createTime" placeholder="选择日期"
                  style="width: 200px"></Date-picker>
              </Form-item>
            </i-col>

          </Row>

          <Row>
            <i-col span="12">
              <Form-item label="证件号码" prop="idCode" style="margin-left: 40%">
                <Input type="text" disabled size="default" v-model="dataForm.idCode" clearable placeholder="请输入"
                  style="width: 200px;" />
              </Form-item>
            </i-col>
            <i-col span="12" v-if="dataForm.blacklistType=='05'">
              <FormItem label="车辆类型" prop="carDealers" style="margin-left: 10%">
                <Select v-model="dataForm.carDealers" placeholder="请选择" size="default" style="width: 200px">
                  <Option value="01">普通车商</Option>
                  <Option value="02">直营车商</Option>
                </Select>
              </FormItem>
            </i-col>

          </Row>
          <Row>
            <i-col span="12" v-if="dataForm.weatherBlacklist==0">
              <Form-item label="黑名单加入原因" prop="blacklistReason" style="margin-left: 40%">
                <Input type="textarea" disabled size="default" style="width: 200px" v-model="dataForm.blacklistReason"
                  :rows="4" placeholder="" />

              </Form-item>
            </i-col>

            <i-col span="12" v-if="dataForm.weatherBlacklist==1">
              <Form-item label="黑名单解除原因" prop="relieveReason" style="margin-left: 40%" >
                <Input type="textarea" disabled size="default" style="width: 200px" v-model="dataForm.relieveReason"
                  :rows="4" placeholder="" />

              </Form-item>
            </i-col>

          </Row>

        </Form>
      </Row>
    </div>
  </div>

</template>

<script>
import {
  blackApplyExamine,
  blackRelieveExamine
} from "@/projects/afs-channel/api/black/black";
export default {
  name: "black-examine",
  components: {},
  data() {
    return {
      name: null,
      loading: true,

      index: 0, // 0:d代表审核页面 1代表 影像资料

      dataForm: {
        blacklistType: null, // 黑名单类型 01-合作商 02-挂靠单位 03-见证人04-开票方 05-车商
        blackName: null, // 名称
        idType: null, // 证件类型 01-身份证 02-统一信用证代码 03 纳税人识别号
        idCode: null, // 证件号码
        createTime: null, // 创建时间
        blacklistReason: null, // 加入黑名单原因
        weatherBlacklist:null, //是否黑名单 1=是 0=否
        relieveReason:null, // 解除黑名单原因

        carDealers: "01", //仅车商可以用：01:普通车商02直营车商

        useStstus: null, //修改的状态状态
        useRemake: null, // 修改的备注
        useStartStopReason: null // 原因
      },

      submitLoading: false,
      total: 0
    };
  },
  methods: {
    init() {
      this.dataForm = this.afs.getPageParams(this);
      if (this.dataForm.blacklistType == "01") {
        this.name = "合作商";
      } else if (this.dataForm.blacklistType == "02") {
        this.name = "挂靠单位";
      } else if (this.dataForm.blacklistType == "03") {
        this.name = "见证人";
      } else if (this.dataForm.blacklistType == "04") {
        this.name = "开票方";
      } else if (this.dataForm.blacklistType == "05") {
        this.name = "车商";
      }
    },
    // 切换审核页面或者影像资料
    clickType(type) {
      this.index = type;
    },

    // 点击返回
    handleBack() {
      this.afs.closeTab(this);
    },
    // 点击提交
    handleCommit(name) {
      if(this.dataForm.useStstus==null||this.dataForm.useStstus==undefined||this.dataForm.useStstus==''){
        this.$Message.error("请选择审批意见！");
        return;

      }
      // 点击提交黑名单
      let params={
        id:this.dataForm.id,
        status:this.dataForm.useStstus,
        blacklistType:this.dataForm.blacklistType,
        idCode:this.dataForm.idCode,
        blacklistReason:this.dataForm.remake,

      }
      // 下面是添加黑名单
      if(this.dataForm.weatherBlacklist=='0'){
        blackApplyExamine(params).then(res => {
          if (res.code === "0000") {
              this.$Message.success("操作成功");
              console.log("我要跳转页面")
              // 跳转审核页面
               this.afs.closeTab(this);

          }
      }).catch(() => {
      });
        // 下面是解除黑名单
      }else if(this.dataForm.weatherBlacklist=='1'){
        blackRelieveExamine(params).then(res => {
          if (res.code === "0000") {
              this.$Message.success("操作成功");
              console.log("我要跳转页面")
              // 跳转审核页面
               this.afs.closeTab(this);

          }
      }).catch(() => {

      });

      }
      
    }
  },
  // 初始化加载
  mounted() {
    this.init();
  }
};
</script>
